//
//  ViewController.m
//  Tom
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "Button.h"
#import "CymController.h"
#import "Button1.h"
#import "Button2.h"
#import "Button3.h"
#import "Button4.h"
#import "Button5.h"
#import "Button6.h"
#import "BUtton7.h"
#import "Button8.h"
#import "Butto9.h"
#import "Button10.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    [self checkImageButton];
   
}

-(void)checkImageButton{
    UIImage *back = [UIImage imageNamed:@"cymbal_0.jpg"];
   
    UIImageView *mage =[[UIImageView alloc]initWithImage:back];
    mage.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:mage];
    [mage release];
    Button *butt = [Button button];
    butt.frame = CGRectMake(50, 400, 50, 50);
    [self.view addSubview:butt];
    [self.view bringSubviewToFront:butt];
    
    [butt addTarget:self action:@selector(rightAction:) forControlEvents:UIControlEventTouchUpInside];
     Button1 *butt1 = [Button1 button];
    butt1.frame = CGRectMake(50, 450, 50, 50);
    [self.view addSubview:butt1];
    
    
    
    
    
    [butt1 addTarget:self action:@selector(right1Action:) forControlEvents:UIControlEventTouchUpInside];
    Button2 *butt2 = [Button2 button];
    butt2.frame = CGRectMake(300, 500, 50, 50);
    [self.view addSubview:butt2];
    
    [butt2 addTarget:self action:@selector(right2Action:) forControlEvents:UIControlEventTouchUpInside];
    Button3 *butt3 = [Button3 button];
    butt3.frame = CGRectMake(50, 500, 50, 50);
    [self.view addSubview:butt3];
    
    [butt3 addTarget:self action:@selector(right3Action:) forControlEvents:UIControlEventTouchUpInside];
    Button4 *butt4 = [Button4 button];
    butt4.frame = CGRectMake(300, 400, 50, 50);
    [self.view addSubview:butt4];
    
    [butt4 addTarget:self action:@selector(right4Action:) forControlEvents:UIControlEventTouchUpInside];
    Button5 *butt5 = [Button5 button];
    butt5.frame = CGRectMake(300, 450, 50, 50);
    [self.view addSubview:butt5];
    
    [butt5 addTarget:self action:@selector(right5Action:) forControlEvents:UIControlEventTouchUpInside];
    Button6 *butt6 = [Button6 button];
    butt6.frame = CGRectMake(160, 120, 100, 50);
    [self.view addSubview:butt6];
    
    [butt6 addTarget:self action:@selector(right6Action:) forControlEvents:UIControlEventTouchUpInside];
    BUtton7 *butt7 = [BUtton7 button];
    butt7.frame = CGRectMake(120, 600, 50, 50);
    [self.view addSubview:butt7];
    
    [butt7 addTarget:self action:@selector(right7Action:) forControlEvents:UIControlEventTouchUpInside];
     Button8 *butt8 = [Button8 button];
    butt8.frame = CGRectMake(250, 520, 50, 80);
    [self.view addSubview:butt8];
    
    [butt8 addTarget:self action:@selector(right8Action:)
    
    forControlEvents:UIControlEventTouchUpInside];
    
    Butto9 *butt9 = [Butto9 button];
    butt9.frame = CGRectMake(140, 420, 100, 100);
    [self.view addSubview:butt9];
    
    [butt9 addTarget:self action:@selector(right9Action:) forControlEvents:UIControlEventTouchUpInside];
    
    Button10 *butt10 = [Button10 button];
    butt10.frame = CGRectMake(200, 600, 50, 50);
    [self.view addSubview:butt10];
   [butt10 addTarget:self action:@selector(right10Action:)
   forControlEvents:UIControlEventTouchUpInside];
    
}
-(void)right1Action:(Button1*)bu{
        UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"angry_1.jpg"]];
        anima.frame = [UIScreen mainScreen].bounds;
        [self.view addSubview:anima];
        [anima release];
        NSMutableArray *muta = [NSMutableArray arrayWithCapacity:25];
        
        for(int i= 0 ; i <= 25;i++){
            
            NSString *name =[NSString stringWithFormat:@"angry_%d.jpg",i];
            UIImage *animage = [UIImage imageNamed:name];
            [muta addObject:animage];
        }
        anima.animationImages = muta;
        anima.animationDuration = 1;
    anima.animationRepeatCount = 1;
    
        [anima startAnimating];
  }

-(void)rightAction:(Button*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cymbal_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:13];
    
    for(int i= 0 ; i < 13;i++){
    NSString *name =[NSString stringWithFormat:@"cymbal_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 1;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
    
}
-(void)right2Action:(Button2*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:80];
    
    for(int i= 0 ; i <= 80;i++){
        
        NSString *name =[NSString stringWithFormat:@"drink_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 5;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right3Action:(Button3*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:39];
    
    for(int i= 0 ; i <= 39;i++){
        
        NSString *name =[NSString stringWithFormat:@"eat_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 5;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right4Action:(Button4*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:23];
    
    for(int i= 0 ; i <= 23;i++){
        
        NSString *name =[NSString stringWithFormat:@"pie_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 2;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right5Action:(Button5*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:55];
    
    for(int i= 0 ; i <= 55;i++){
        
        NSString *name =[NSString stringWithFormat:@"scratch_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 2;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right6Action:(Button6*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:80];
    
    for(int i= 0 ; i <= 80;i++){
        
        NSString *name =[NSString stringWithFormat:@"knockout_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 5;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right7Action:(BUtton7*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:29];
    
    for(int i= 0 ; i <= 29;i++){
        
        NSString *name =[NSString stringWithFormat:@"footRight_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 5;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right8Action:(Button8*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:27];
    
    for(int i= 0 ; i <= 27;i++){
        
        NSString *name =[NSString stringWithFormat:@"fart_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 5;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right9Action:(Butto9*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:27];
    
    for(int i= 0 ; i <= 27;i++){
        
        NSString *name =[NSString stringWithFormat:@"stomach_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 3;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}
-(void)right10Action:(Button10*)bu{
    UIImageView *anima =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"drink_0.jpg"]];
    anima.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:anima];
    [anima release];
    NSMutableArray *muta = [NSMutableArray arrayWithCapacity:29];
    
    for(int i= 0 ; i <= 29;i++){
        
        NSString *name =[NSString stringWithFormat:@"footLeft_%d.jpg",i];
        UIImage *animage = [UIImage imageNamed:name];
        [muta addObject:animage];
    }
    anima.animationImages = muta;
    anima.animationDuration = 3;
     anima.animationRepeatCount = 1;
    [anima startAnimating];
}





@end
